#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N], n, m;

int check(int mid) {
    int res = 0;
    for (int i = 1, lst = 0; i <= n; i++) {
        if (lst && a[i] - a[lst] < mid) continue;
        res++, lst = i;
    }
    return res;
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= n; i++) cin >> a[i];
    sort(a + 1, a + n + 1);
    int l = 0, r = 1e9 + 10;
    while (l + 1 != r) {
        int mid = (l + r) / 2;
        if (check(mid) >= m) l = mid;
        else r = mid;
    }
    cout << l << '\n';
    return 0;
}